package com.shujia.day14;

import java.io.*;

public class Code14CopyFile {
    public static void main(String[] args) throws IOException {

        FileWriter fileWriter = new FileWriter("data/cc.txt");
        BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);

        FileReader fileReader = new FileReader("data/bb.txt");
        BufferedReader bufferedReader = new BufferedReader(fileReader);

        String line = "";
        while ((line = bufferedReader.readLine())!=null){
            bufferedWriter.write(line);
            bufferedWriter.newLine();  // 可以换行
            bufferedWriter.flush(); // 有缓冲需要对其进行刷写操作
        }


        fileWriter.close();
        bufferedWriter.close();
        fileReader.close();
        bufferedReader.close();
    }
}
